using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace Ssb
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class FighterAnimation
        : Animation
    {
        public List<Hitbox> Hitboxes { get; protected set; }
        public List<GFX> GEffects { get; protected set; }
        public bool Enabled2 { get; protected set; }

        public FighterAnimation(List<Hitbox> hitboxes, List<GFX> gEffects, Animation anim, Game game)
            : base(new Vector2(0), anim.Anim, game)
        {
            Hitboxes = hitboxes;
            GEffects = gEffects;
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        public override void Update(GameTime gt)
        {
            if (Enabled2)
            {
                foreach (Hitbox hb in Hitboxes) // update the hitoxes
                {
                    hb.Coords = this.Coords;
                    hb.Update(gt);
                }

                foreach (GFX gfx in GEffects) // update the gfx
                {
                    gfx.Coords = this.Coords;
                    gfx.Update(gt);
                }

                base.Update(gt);
            }
        }

        public override void Draw(GameTime gt)
        {
            foreach (GFX gfx in GEffects)
            {
                if (gfx.Enabled2)
                    gfx.Draw(gt);
            }

            base.Draw(gt);
        }

        public void Enable()
        {
            Enabled2 = true;
        }

        public void Disable()
        {
            Enabled2 = false;
        }
    }
}